package com.weather.util;

import java.util.Iterator;
import java.util.List;

import com.weather.bean.CityWeatherInfoBean;
import com.weather.bean.ProvinceCodeBean;
import com.weather.dao.CityWeatherInfoDAO;
import com.weather.dao.ProvinceCodeDAO;

public class DAOUtil {
	public static CityWeatherInfoBean getCity(String province_name, String city_name){
		CityWeatherInfoBean cwib = null;
		List<ProvinceCodeBean> provinces = ProvinceCodeDAO.getAll();
		Iterator iter = provinces.iterator();
		while(iter.hasNext()){
			ProvinceCodeBean province =(ProvinceCodeBean)iter.next();
			if(province.getProvinceName().equals(province_name)){
				String province_code =  province.getProvinceCode();
				cwib = CityWeatherInfoDAO.getCity(province_code, city_name);
			}
		}
		return cwib;
	}
}
